{include file="common:meta" /}
<div class="mt-10">
    <form class="form-inline" role="form" method="get" action="{:url('agent/user_search')}">
        <div class="form-group">
            <span style="color: red;">用户查询</span> 昵称:<input style="width: 120px;" type="text" class="input-text" name="nickname" placeholder="请输入昵称" value="{$nickname ? $nickname : '';}">
            账号:<input style="width: 120px;" type="text" class="input-text" name="username" placeholder="请输入账号" value="{$username ? $username : '';}">
            开始时间：<input type="text" name="start" autocomplete="off" id="test1">-<input type="text" name="end" id="test2" autocomplete="off">
        </div>
        <button type="submit" class="btn btn-default">用户查询</button>
    </form>
    <div class="table-responsive">
    <table class="table table-border table-bordered table-hover table-bg" id="mytable">
        <thead>
        <tr>
            <th scope="col" colspan="6">用户统计列表</th>
        </tr>
        <tr class="text-c">
            <th width="10">编号</th>
            <th width="30">用户名</th>
            <th width="20">存款</th>
            <th width="20">下注</th>
            <th width="20">中奖</th>
        </tr>
        </thead>
        <tbody>
        {volist name="data" id="vo"}
        <tr class="text-c">
            <td>{$vo.id}</td>
            <td>{$vo.nickname}</td>
            <td>{$vo.coin}</td>
            <td>{$vo.user_bet_coin}</td>
            <td></td>
        </tr>
        {/volist}
        {$quick ? $quick : ''}
        </tbody>
        <tr id="totalRow"></tr>
    </table>
    </div>
    <tr>
        <td>所有用户总计</td>
        <td></td>
        <td></td>
        <td>{$sum_coin ?? ''}</td>
    </tr>
</div>
<div style="float: right;">{$page}</div>


{include file="common:footer" /}
<!--请在下方写此页面业务相关的脚本-->
{load href="__STATIC__/admin/lib/My97DatePicker/4.8/WdatePicker.js"}
{load href="__STATIC__/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"}
{load href="__STATIC__/admin/lib/laypage/1.2/laypage.js"}
<script type="text/javascript">
    laydate.render({
        elem: '#test1' //指定元素
        ,calendar: true
        ,theme: '#333'
        ,showBottom: true    //false隐藏控件底部按钮
    });
    laydate.render({
        elem: '#test2' //指定元素
        ,calendar: true
        ,theme: '#333'
        ,showBottom: true    //false隐藏控件底部按钮
    });
</script>
<script>
    $(document).ready(function() {
        var totalRow = 0;
        $('#mytable tr').each(function() {
            $(this).find('td:eq(2)').each(function(){
                totalRow += parseFloat($(this).text());
            });
        });

        var user_bet_coin = 0;
        $('#mytable tr').each(function() {
            $(this).find('td:eq(3)').each(function(){
                user_bet_coin += parseFloat($(this).text());
            });
        });
        $('#totalRow').append('<td>当前页合计</td><td></td><td style="text-align: center">'+totalRow.toFixed(2)+'</td><td  style="text-align: center">'+user_bet_coin.toFixed(2)+'</td><td></td>');
    });
</script>